.\" -*- nroff -*-
.\" Copyright 2010 Cisco Systems, Inc.  All rights reserved.
.\" Copyright 2006-2008 Sun Microsystems, Inc.
.\" Copyright (c) 1996 Thinking Machines Corporation
.\" Copyright (c) 2020      Google, LLC. All rights reserved.
.\" $COPYRIGHT$
.TH MPI_Type_create_resized 3 "#OMPI_DATE#" "#PACKAGE_VERSION#" "#PACKAGE_NAME#"
.SH NAME
\fBMPI_Type_create_resized\fP \- Returns a new data type with new extent and upper and lower bounds.

.SH SYNTAX
.ft R
.SH C Syntax
.nf
#include <mpi.h>
int MPI_Type_create_resized(MPI_Datatype \fIoldtype\fP, MPI_Aint\fI lb\fP,
	MPI_Aint \fIextent\fP, MPI_Datatype *\fInewtype\fP)

.fi
.SH Fortran Syntax (see FORTRAN 77 NOTES)
.nf
USE MPI
! or the older form: INCLUDE 'mpif.h'
MPI_TYPE_CREATE_RESIZED(\fIOLDTYPE, LB, EXTENT, NEWTYPE, IERROR\fP)
	INTEGER	\fIOLDTYPE, NEWTYPE, IERROR\fP
	INTEGER(KIND=MPI_ADDRESS_KIND)	\fILB, EXTENT\fP

.fi
.SH Fortran 2008 Syntax
.nf
USE mpi_f08
MPI_Type_create_resized(\fIoldtype\fP, \fIlb\fP, \fIextent\fP, \fInewtype\fP, \fIierror\fP)
	INTEGER(KIND=MPI_ADDRESS_KIND), INTENT(IN) :: \fIlb\fP, \fIextent\fP
	TYPE(MPI_Datatype), INTENT(IN) :: \fIoldtype\fP
	TYPE(MPI_Datatype), INTENT(OUT) :: \fInewtype\fP
	INTEGER, OPTIONAL, INTENT(OUT) :: \fIierror\fP

.fi
.SH INPUT PARAMETERS
.ft R
.TP 1i
oldtype
Input data type (handle).
.TP 1i
lb
New lower bound of data type (integer).
.TP 1i
extent
New extent of data type (integer).

.SH OUTPUT PARAMETERS
.ft R
.TP 1i
newtype
Output data type (handle).
.TP 1i
IERROR
Fortran only: Error status (integer).

.SH DESCRIPTION
.ft R
MPI_Type_create_resized returns in \fInewtype\fP a handle to a new data type that is identical to \fIoldtype\fP, except that the lower bound of this new data type is set to be \fIlb\fP, and its upper bound is set to be \fIlb\fP + \fIextent\fP. Any previous \fIlb\fP and \fIub\fP markers are erased, and a new pair of lower bound and upper bound markers are put in the positions indicated by the \fIlb\fP and \fIextent\fP arguments. This affects the behavior of the data type when used in communication operations, with \fIcount\fP > 1, and when used in the construction of new derived data types.

.SH FORTRAN 77 NOTES
.ft R
The MPI standard prescribes portable Fortran syntax for
the \fILB\fP and \fIEXTENT\fP arguments only for Fortran 90. FORTRAN 77
users may use the non-portable syntax
.sp
.nf
     INTEGER*MPI_ADDRESS_KIND \fILB\fP
or
     INTEGER*MPI_ADDRESS_KIND \fIEXTENT\fP
.fi
.sp
where MPI_ADDRESS_KIND is a constant defined in mpif.h
and gives the length of the declared integer in bytes.

.SH NOTE
.ft R
Use of MPI_Type_create_resized is strongly recommended over the old MPI-1 functions MPI_Type_extent and MPI_Type_lb.

.SH ERRORS
Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument.
.sp
Before the error value is returned, the current MPI error handler is
called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error.

.SH SEE ALSO

MPI_Type_get_extent

